"use strict";
cc._RF.push(module, '08c3bhOykROg4lQbZ/9wtIJ', 'disPlayLayer');
// scripts/scenes/hall/disPlayLayer.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var disPlayConfig_1 = require("./disPlayConfig");
var disPlayItem_1 = require("./disPlayItem");
var disFindItem_1 = require("./disFindItem");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var disPlayLayer = /** @class */ (function (_super) {
    __extends(disPlayLayer, _super);
    function disPlayLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.ndContextList = null;
        _this.pbDisplayList = null;
        _this.pbFindDisItem = null;
        _this.ndPos = null;
        _this.szContent = null;
        _this.editFind = null;
        _this.ndFindResult = null;
        _this.ndFindListContent = null;
        _this.lbSearchTitle = null;
        return _this;
        // update (dt) {}
    }
    disPlayLayer.prototype.onLoad = function () {
        this.initDesk();
    };
    disPlayLayer.prototype.start = function () {
        this.ndFindResult.active = false;
    };
    disPlayLayer.prototype.initDesk = function () {
        var all = disPlayConfig_1.Desk.getDeskDisplayListInfo();
        for (var i = 0; i < all.length; i++) {
            var display = all[i];
            var node = cc.instantiate(this.pbDisplayList);
            this.ndContextList.addChild(node);
            var com = node.getComponent(disPlayItem_1.default);
            com.bindData(display);
            // const {width, height} = cc.view.getCanvasSize();
            var _a = this.ndPos.getPosition(), x = _a.x, y = _a.y;
            var xi = i % 3;
            var yj = Math.floor(i / 3);
            com.setMaxMinParam(cc.v2(x + 140 + xi * (this.szContent.width + 50), y - 100 - yj * (this.szContent.height + 80)), cc.v2(0, 0), cc.size(this.szContent.width / 750, this.szContent.height / 1334));
        }
    };
    disPlayLayer.prototype.onEditInputOver = function () {
        if (!this.editFind.string) {
            return;
        }
        this.ndFindResult.active = true;
        //
        var ids = disPlayConfig_1.Desk.searchIdsOfName(this.editFind.string);
        //
        this.lbSearchTitle.string = "\"" + this.editFind.string + "\" " + ids.length + "\u4E2A\u67E5\u627E\u7ED3\u679C";
        //
        for (var _i = 0, ids_1 = ids; _i < ids_1.length; _i++) {
            var id = ids_1[_i];
            var node = cc.instantiate(this.pbFindDisItem);
            this.ndFindListContent.addChild(node);
            node.getComponent(disFindItem_1.default).setId(id);
        }
    };
    disPlayLayer.prototype.onTouchCloseFindResult = function () {
        this.ndFindListContent.destroyAllChildren();
        this.ndFindResult.active = false;
    };
    __decorate([
        property(cc.Node)
    ], disPlayLayer.prototype, "ndContextList", void 0);
    __decorate([
        property(cc.Prefab)
    ], disPlayLayer.prototype, "pbDisplayList", void 0);
    __decorate([
        property(cc.Prefab)
    ], disPlayLayer.prototype, "pbFindDisItem", void 0);
    __decorate([
        property(cc.Node)
    ], disPlayLayer.prototype, "ndPos", void 0);
    __decorate([
        property(cc.Size)
    ], disPlayLayer.prototype, "szContent", void 0);
    __decorate([
        property(cc.EditBox)
    ], disPlayLayer.prototype, "editFind", void 0);
    __decorate([
        property(cc.Node)
    ], disPlayLayer.prototype, "ndFindResult", void 0);
    __decorate([
        property(cc.Node)
    ], disPlayLayer.prototype, "ndFindListContent", void 0);
    __decorate([
        property(cc.Label)
    ], disPlayLayer.prototype, "lbSearchTitle", void 0);
    disPlayLayer = __decorate([
        ccclass
    ], disPlayLayer);
    return disPlayLayer;
}(cc.Component));
exports.default = disPlayLayer;

cc._RF.pop();